package com.larry.spark.rdd.instance

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark01_RDD_Instance_Memory_partition {

  def main(args: Array[String]): Unit = {
    //TODO  使用spark

    val conf = new SparkConf().setMaster("local[*]").setAppName("rdd")
    val sc = new SparkContext(conf)

    //从内存中创建分区
    //parallelize(seq, numSlices)
    //new ParallelCollectionRDD[T](this, seq, numSlices, Map[Int, Seq[String]]())
    val rdd:RDD[Int] = sc.makeRDD(
      Seq(1,2,3,4),2
    )

    rdd.saveAsTextFile("output")

    sc.stop()
  }


}
